/***********************************************************************
** Copyright (C) 2011 Anthony Naddeo <anthony.naddeo@gmail.com>
**
** This file is part of scenic
**
** scenic is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 3 of the License, or
** (at your option) any later version.
**
** scenic is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this package; If not, see <http://www.gnu.org/licenses/>.
**
***********************************************************************/

import QtQuick 1.1
import com.meego 1.0

Page {
    id: mainPage
    tools: commonTools

	Flickable{
		anchors.fill: parent
		contentHeight: column.height+50

		Column{
			id: column
			spacing: 30
			anchors.top: parent.top
			anchors.left: parent.left
			anchors.right: parent.right
			anchors.margins:30

			/////////////////////////////////////////
			ButtonRow {
				anchors.horizontalCenter: parent.horizontalCenter

				Button{
					text: "Hourly"
					checked: Settings.get("mode") == "Hourly" || !Settings.get("mode") == "Random"
					onClicked: Settings.set("mode", text)
				}
				Button{
					text: "Random"
					checked: Settings.get("mode") == "Random"
					onClicked: Settings.set("mode", text)
				}
			}

			Hint{
				width: parent.width
				text: "<b>Hourly:</b> Scenic will use the wallpaper.conf file to change the wallpaper per hour.<br><br> \
					   <b>Random:</b> Scenic will change the wallpaper to a random image in the wallpaper.conf directory \
				at the interval you specify (not cpu intensive at all)"
			}

			/////////////////////////////////////////
			Item {
				width: parent.width
				height: label.height
				Label{
					id: label
					anchors.left: parent.left
					anchors.verticalCenter: parent.verticalCenter
					text: "Enabled"
				}
				Switch{
					anchors.right: parent.right
					anchors.verticalCenter: parent.verticalCenter
					checked: Settings.get("enabled") == "true"
					onCheckedChanged: Settings.set("enabled", checked)

				}
			}
			/////////////////////////////////////////
			Item {
				width: parent.width
				height: label.height
				Label{
					id: wallpaperLabel
					anchors.left: parent.left
					anchors.verticalCenter: parent.verticalCenter
					text: "Folder"
				}
				TextField{
					anchors.left: wallpaperLabel.right
					anchors.right: parent.right
					anchors.leftMargin: 20
					anchors.verticalCenter: parent.verticalCenter
					text: Settings.get("wallpaper") || "/opt/scenic/wallpaper/"
					onTextChanged: Settings.set("wallpaper", text)
				}
			}
			Hint{
				width: parent.width
				text: "The folder that contains all of the images and a wallpaper.conf file. \
						The sample set in '/opt/scenic/wallpaper/' demonstrates Scenic's usage with a day to night \
						wallpaper set."
			}
			/////////////////////////////////////////
			Item {
				width: parent.width
				height: label.height
				Label{
					id: intLabel
					anchors.left: parent.left
					anchors.verticalCenter: parent.verticalCenter
					text: "Interval"
				}
				TextField{
					anchors.left: intLabel.right
					anchors.right: parent.right
					anchors.leftMargin: 20
					anchors.verticalCenter: parent.verticalCenter
					text: Settings.get("interval") || "2"
					onTextChanged: Settings.set("interval", text)
					inputMethodHints: Qt.ImhDigitsOnly | Qt.ImhNoPredictiveText
				}
			}
			Hint{
				width: parent.width
				text: "The time in minutes for Scenic to check and (if necessary) update the wallpaper.\
						More relevant for 'Random' mode."
			}
			Button{
				text: "Update Now"
				anchors.horizontalCenter: parent.horizontalCenter
				onClicked: Settings.update();
			}

		}
	}




}
